//package com.example.flutterprintapp;//package com.max.flutterprint;
//
//import java.io.UnsupportedEncodingException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Set;
//
//import android.R.string;
//import android.app.Activity;
//import android.bluetooth.BluetoothAdapter;
//import android.bluetooth.BluetoothDevice;
//import android.content.Intent;
//import android.graphics.Color;
//import android.os.Bundle;
//import android.view.View;
//import android.widget.AdapterView;
//import android.widget.ListView;
//import android.widget.SimpleAdapter;
//import android.widget.Toast;
//import android.widget.Button;
//
//public class Demo_ad_escActivity extends Activity {
//	/** Called when the activity is first created. */
//	public static BluetoothAdapter myBluetoothAdapter;
//	public String SelectedBDAddress;
//	@Override
//	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.main);
//		if(!ListBluetoothDevice())finish();
//		Button Button1 = (Button) findViewById(R.id.button1);
//		Button1.setOnClickListener(new Button.OnClickListener()
//		{
//			public void onClick(View arg0)
//			{
//				Print1(SelectedBDAddress);
//			}
//		});
//		Button Button2 = (Button) findViewById(R.id.button2);
//		Button2.setOnClickListener(new Button.OnClickListener()
//		{
//			public void onClick(View arg0)
//			{
//				Print2(SelectedBDAddress);
//			}
//		});
//		Button Button3 = (Button) findViewById(R.id.button3);
//		Button3.setOnClickListener(new Button.OnClickListener()
//		{
//			public void onClick(View arg0)
//			{
//				Print3(SelectedBDAddress);
//			}
//		});
//		Button Button4 = (Button) findViewById(R.id.button4);
//		Button4.setOnClickListener(new Button.OnClickListener()
//		{
//			public void onClick(View arg0)
//			{
//				Print4(SelectedBDAddress);
//			}
//		});
//		Button Button5 = (Button) findViewById(R.id.button5);
//		Button5.setOnClickListener(new Button.OnClickListener()
//		{
//			public void onClick(View arg0)
//			{
//				Print5(SelectedBDAddress);
//			}
//		});
//		Button Button6 = (Button) findViewById(R.id.button6);
//		Button6.setOnClickListener(new Button.OnClickListener()
//		{
//			public void onClick(View arg0)
//			{
//				Print6(SelectedBDAddress);
//			}
//		});
//	}
//	public boolean ListBluetoothDevice()
//	{
//		final List<Map<String,String>> list=new ArrayList<Map<String, String>>();
//		ListView listView = (ListView) findViewById(R.id.listView1);
//		SimpleAdapter m_adapter = new SimpleAdapter( this,list,
//				android.R.layout.simple_list_item_2,
//				new String[]{"DeviceName","BDAddress"},
//				new int[]{android.R.id.text1,android.R.id.text2}
//		);
//		listView.setAdapter(m_adapter);
//
//		if((myBluetoothAdapter = BluetoothAdapter.getDefaultAdapter())==null)
//		{
//			Toast.makeText(this,"没有找到蓝牙适配器", Toast.LENGTH_LONG).show();
//			return false;
//		}
//
//		if(!myBluetoothAdapter.isEnabled())
//		{
//			Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
//			startActivityForResult(enableBtIntent, 2);
//		}
//
//		Set <BluetoothDevice> pairedDevices = myBluetoothAdapter.getBondedDevices();
//		if (pairedDevices.size() <= 0)return false;
//		for (BluetoothDevice device : pairedDevices)
//		{
//			Map<String,String> map=new HashMap<String, String>();
//			map.put("DeviceName", device.getName());
//			map.put("BDAddress", device.getAddress());
//			list.add(map);
//		}
//		listView.setOnItemClickListener(new ListView.OnItemClickListener()
//		{
//			public void onItemClick(AdapterView<?> parent, View view, int position, long id)
//			{
//				SelectedBDAddress = list.get(position).get("BDAddress");
//				if (((ListView)parent).getTag() != null){
//					((View)((ListView)parent).getTag()).setBackgroundDrawable(null);
//				}
//				((ListView)parent).setTag(view);
//				view.setBackgroundColor(Color.BLUE);
//			}
//		});
//		return true;
//	}
//	public void Print1(String BDAddress)
//	{
//		if(!BtSPP.OpenPrinter(BDAddress))
//		{
//			Toast.makeText(this,BtSPP.ErrorMessage, Toast.LENGTH_LONG).show();
//			return;
//		}
//		try {
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1B,0x33,0x00});	//设置行间距为0
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x00});	//设置不居中
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x01});	//设置倍高
//			BtSPP.SPPWrite(String.format("    %-16s", "苏驰物流").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x48,0x02});	//设置条码内容打印在条码下方
//			BtSPP.SPPWrite(new byte[]{0x1d,0x77,0x03});	//设置条码宽度0.375
//			BtSPP.SPPWrite(new byte[]{0x1d,0x68,0x40});	//设置条码高度64
//			//打印code128条码
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x18});
//			BtSPP.SPPWrite("1234567890\0".getBytes("GBK"));
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x00});	//设置不倍高
//			BtSPP.SPPWrite(String.format("┏━━┳━━━━━━━┳━━┳━━━━━━━━┓\n").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x01});	//设置倍高
//			BtSPP.SPPWrite(String.format("┃发站┃%-12s┃到站┃%-14s┃\n","杭州","宝应").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x00});	//设置不倍高
//			BtSPP.SPPWrite(String.format("┣━━╋━━━━━━━╋━━╋━━━━━━━━┫\n").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x01});	//设置倍高
//			BtSPP.SPPWrite(String.format("┃件数┃%6d/%-7d┃单号┃%-16d┃\n",1,222,55555555).getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x00});	//设置不倍高
//			BtSPP.SPPWrite(String.format("┣━━┻┳━━━━━━┻━━┻━━━━━━━━┫\n").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x01});	//设置倍高
//			BtSPP.SPPWrite(String.format("┃收件人┃%-28s┃\n","【送】孙俊/宁新富").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x00});	//设置不倍高
//			BtSPP.SPPWrite(String.format("┣━━━╋━━━━━━┳━━┳━━━━━━━━┫\n").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x01});	//设置倍高
//			BtSPP.SPPWrite(String.format("┃业务员┃%-10s┃名称┃%-14s┃\n","测试","杭州").getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x00});	//设置不倍高
//			BtSPP.SPPWrite(String.format("┗━━━┻━━━━━━┻━━┻━━━━━━━━┛\n").getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1b,0x61,0x01});	//设置居中
//			BtSPP.SPPWrite(new byte[]{0x1d,0x21,0x01});	//设置倍高
//			BtSPP.SPPWrite(String.format("日期：%10s\n","2011-05-16").getBytes("GBK"));
//
//			BtSPP.SPPWrite("\n\n\n\n".getBytes("GBK"));
//		} catch (UnsupportedEncodingException e) {
//		}
//
//		BtSPP.SPPClose();
//	}
//	public void Print2(String BDAddress)
//	{
//		if(!BtSPP.OpenPrinter(BDAddress))
//		{
//			Toast.makeText(this,BtSPP.ErrorMessage, Toast.LENGTH_LONG).show();
//			return;
//		}
//
//		try {
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(String.format("\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("012345678901234567890123456789012\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("	       交通违章罚款决定书\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("            NO.10012001091023009\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("姓名:林秀芳 ____________________\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("身份证:21021119580822291X ______\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("年龄:39 ________________________\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("地址:大连市玉山一街68-1-25号____\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("车型:普通大客车  车号:辽B.11045\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("违章时间:2001年11月22日09时24分\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("处罚地点:辽宁省大连市沙河口玉山\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("         街路口\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("违章事实:酒后驾车无证驾驶闯红灯\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("         骂人打架\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("根据《中华人民共和国道路交通管理\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("条例》12条23款，《中华人民共和国\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("高速公路管理办法》32条34款，\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("《辽宁省道路交通管理实施办法》45\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("条44款之规定。决定给予罚款1500元\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("的处罚。\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("    如你（单位）不服本处罚决定，\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("可在收到决定书之日起二个月内向上\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("一级公安交通管理机关申请复议或依\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("法向人民法院起诉。\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("                值勤民警：郭泗东\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("                2001年11月22日\n").getBytes("GBK"));
//			BtSPP.SPPWrite(String.format("                当事人：________\n").getBytes("GBK"));
//
//			BtSPP.SPPWrite(String.format("\n\n\n\n").getBytes("GBK"));
//
//		} catch (UnsupportedEncodingException e) {
//		}
//
//		BtSPP.SPPClose();
//	}
//	public void Print3(String BDAddress)
//	{
//		if(!BtSPP.OpenPrinter(BDAddress))
//		{
//			Toast.makeText(this,BtSPP.ErrorMessage, Toast.LENGTH_LONG).show();
//			return;
//		}
//		try {
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x01});	//居中
//			BtSPP.SPPWrite("*****华丽的分割线*****\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x00});	//居左
//			BtSPP.SPPWrite("测试开始\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("(1、标题，居中，3倍大小，下划线，粗体)\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x01});	//居中
//			BtSPP.SPPWrite(new byte[]{0x1D,0x21,0x22});	// 3倍字体大小
//			BtSPP.SPPWrite(new byte[]{0x1B,0x45,0x01});	// 粗体
//			BtSPP.SPPWrite(new byte[]{0x1B,0x2D,0x32});	// 2点粗下划线
//			BtSPP.SPPWrite("标题\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x00});	//左对齐
//			BtSPP.SPPWrite(new byte[]{0x1B,0x21,0x00});	// 还原默认字体大小，取消下划线，取消粗体模式
//			BtSPP.SPPWrite("(2、条码：左对齐）\n".getBytes("GBK"));
//			try {Thread.sleep(500);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x45,0x0D,0x31,0x39,0x41,0x54,0x5A,0x2D,0x2E,0x20,0x24,0x2F,0x2B,0x25,0x44});	//code 39 条码：19ATZ-. $/+%D
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（3、正文1，默认打印模式，绝对打印位置5mm）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x24,0x28,(byte) 0x80});	// 设置绝对打印位置5mm，80表示00
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。2、0123456789-ABCD-9876543210中文测试。3、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（4、继续条码，居中）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x01});	//居中
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x45,0x0D,0x31,0x39,0x41,0x54,0x5A,0x2D,0x2E,0x20,0x24,0x2F,0x2B,0x25,0x44});	//code 39 条码：19ATZ-. $/+%D
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x00});	//左对齐
//			BtSPP.SPPWrite("（5、左对齐 0x3F点行间距）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x33,0x1E});	//设置行间距为：3.75mm
//			BtSPP.SPPWrite("以下是校长高震东在国内的讲演：\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x32});	//设置默认行间距：1mm
//			BtSPP.SPPWrite("（6、默认行间距）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x24,0x28,(byte) 0x80});	// 设置绝对打印位置5mm，80表示00
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。2、0123456789-ABCD-9876543210中文测试。3、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（7 、条码）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x02,0x30,0x31,0x37,0x31,0x32,0x33,0x34,0x35,0x00});	//EAN8：01712345
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（8、0行间距）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x33,0x00});	//设置行间距为：0mm
//			BtSPP.SPPWrite(new byte[]{0x1B,0x24,0x28,(byte) 0x80});	// 设置绝对打印位置5mm，80表示00
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。2、0123456789-ABCD-9876543210中文测试。3、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（9 、条码）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x03,0x30,0x31,0x37,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x35,0x00});	//EAN13：0171234567895
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（10、3个预存储图章）\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1C,0x70,0x00,0x00,});		// 打印预存储图片
//			/*----CS打印机不再支持--XT423继续支持------------
//			BtSPP.SPPWrite(new byte[]{0x1C,0x50,0x01});	// 打印编号为01的预存储图片
//			BtSPP.SPPWrite(new byte[]{0x1C,0x50,0x02});	// 打印编号为02的预存储图片
//			BtSPP.SPPWrite(new byte[]{0x1C,0x50,0x03});	// 打印编号为03的预存储图片
//			*/
//
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（11、16点阵字符）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1B,0x4D,0x01});		//	选择16点阵字体
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。2、0123456789-ABCD-9876543210中文测试。3、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			try {Thread.sleep(2000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x4D,0x00});		//	选择24点阵字体
//			BtSPP.SPPWrite("（12、还原默认字符大小，二维条码PDF417）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x77,0x04});		//条码宽度4倍
//			BtSPP.SPPWrite(new byte[]{0x1D,0x5A,0x00});		//选择PDF417条码
//			String strPDF417="上海芝柯打印技术有限公司 地址：上海浦东秀浦路3999号6号楼\0";
//			short  strPDF417Len=(short)strPDF417.getBytes("GBK").length;
//			//打印PDF417条码
//			BtSPP.SPPWrite(new byte[]{0x1B,0x5A,0x02,0x02,0x03,(byte)(strPDF417Len&0x00FF),(byte)(strPDF417Len/256)});
//			BtSPP.SPPWrite(strPDF417.getBytes("GBK"));
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite("（13、反白打印）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1D,0x42,0x01});		//选择反白打印模式
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1D,0x42,0x00});		//取消反白打印模式
//			BtSPP.SPPWrite("(14、条码.10点高度条码)\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x68,0x0A});		//设置条码打印高度为10点：1.25mm
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x04,0x2A,0x31,0x32,0x33,0x34,0x35,0x36,0x2A,0x00});		//打印code39码：*123456*
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（15、正文）\n".getBytes("GBK"));
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（16、条码，18点高度条码）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x68,0x12});		//设置条码打印高度为18点：2.25mm
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x04,0x2A,0x31,0x32,0x33,0x34,0x35,0x36,0x2A,0x00});		//打印code39码：*123456*
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（17、8个水平制表位）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x44,0x04,0x09,0x0F,0x14,0x19,0x1F,0x24,0x29,0x2F,0x34,0x39,0x3F,(byte) 0xff});		//设置12点水平制表位，因为最大为8，所有后面4个无效
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第一个制表位打印
//			BtSPP.SPPWrite("第一".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第二个制表位打印
//			BtSPP.SPPWrite("第二".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第三个制表位打印
//			BtSPP.SPPWrite("第三".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第四个制表位打印
//			BtSPP.SPPWrite("第四".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第五个制表位打印
//			BtSPP.SPPWrite("第五".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第六个制表位打印
//			BtSPP.SPPWrite("第六".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第七个制表位打印
//			BtSPP.SPPWrite("第七".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第八个制表位打印
//			BtSPP.SPPWrite("第八".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x09});		//选择第九个制表位打印
//			BtSPP.SPPWrite("第九个应该没有".getBytes("GBK"));
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite("（18、条码）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x01,0x30,0x31,0x39,0x37,0x37,0x31,0x31,0x30,0x00});		//打印UPC-E码：01977110
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（19、0X30点的字符间距）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x20,0x30});		//设置字符间距0x30个点
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite(new byte[]{0x1B,0x20,0x00});		//设置字符间距0x00个点
//			BtSPP.SPPWrite("（20、粗体，下划线，2倍大小）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1b,0x21,(byte) 0xfe});		//设置字符为粗体，下划线，2倍大小的24点阵
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite("（21、条码）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x01,0x30,0x31,0x39,0x37,0x37,0x31,0x31,0x30,0x00});		//打印UPC-E码：01977110
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("（22、左边距0x2F）\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x4C,0x2F,0x00});		//设置左边距0x2F
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。2、0123456789-ABCD-9876543210中文测试。3、0123456789-ABCD-9876543210中文测试。4、0123456789-ABCD-9876543210中文测试。\n".getBytes("GBK"));
//
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite("（23、竖直条码）\n".getBytes("GBK"));
//			BtSPP.SPPWrite("(24、条码) \n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x01,0x30,0x31,0x39,0x37,0x37,0x31,0x31,0x30,0x00});		//打印UPC-E码：01977110
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("(25、旋转90度) \n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1B,0x56,0x01});		//设置顺时针选择90度
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。 \n".getBytes("GBK"));
//
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x56,0x00});		//设置为不旋转
//			BtSPP.SPPWrite("(26、条码) \n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x6B,0x01,0x30,0x31,0x39,0x37,0x37,0x31,0x31,0x30,0x00});		//打印UPC-E码：01977110
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("(27、旋转180度)\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x56,0x02});		//设置顺时针选择180度
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。 \n".getBytes("GBK"));
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x56,0x00});		//设置为不旋转
//
//			try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite("(28、二维条码DataMatrix)\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x77,0x04});		//条码宽度4倍
//			BtSPP.SPPWrite(new byte[]{0x1D,0x5A,0x01});		//选择DataMatrix条码
//			String strDataMatrix="123-DataMatrix-二维码测试-321\0";
//			short  strDataMatrixLen=(short)strDataMatrix.getBytes("GBK").length;
//			//打印DataMatrix条码
//			BtSPP.SPPWrite(new byte[]{0x1B,0x5A,0x00,0x00,0x00,(byte)(strDataMatrixLen&0x00FF),(byte)(strDataMatrixLen/256)});
//			BtSPP.SPPWrite(strDataMatrix.getBytes("GBK"));
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//
//			BtSPP.SPPWrite("(29、旋转270度)\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1B,0x56,0x03});		//设置顺时针选择270度
//			BtSPP.SPPWrite("1、0123456789-ABCD-9876543210中文测试。 \n".getBytes("GBK"));
//
//			try {Thread.sleep(500);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x56,0x00});		//设置为不旋转
//			BtSPP.SPPWrite("(30、二维条码QR-CODE)\n".getBytes("GBK"));
//			BtSPP.SPPWrite(new byte[]{0x1D,0x77,0x04});		//条码宽度4倍
//			BtSPP.SPPWrite(new byte[]{0x1D,0x5A,0x02});		//选择QR-CODE条码
//			//打印QR-CODE
//			String strQr="123-QR二维码测试-321\0";
//			short  strQrLen=(short)strQr.getBytes("GBK").length;
//			BtSPP.SPPWrite(new byte[]{0x1B,0x5A,0x00,0x01,0x00,(byte)(strQrLen&0x00FF),(byte)(strQrLen/256)});
//			//打印QR-CODE内容
//			BtSPP.SPPWrite(strQr.getBytes("GBK"));
//			BtSPP.SPPWrite("\n".getBytes("GBK"));
//			//-------曲线打印指令-----新机器不再支持-----------
//			/*
//			try {Thread.sleep(2000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x01,0x1A,0x00,0x3F,0x02});							//打印第1行线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x22,0x00,0x00,0x00,(byte) 0xCE,(byte) 0xD2,0x00});		//2行线段上打印第1个字符
//			BtSPP.SPPWrite(new byte[]{0x1D,0x22,0x01,0x27,0x02,(byte) 0xB5,(byte) 0xC4,0x00});		//2行线段上打印第2个字符
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x1B,0x00,0x1C,0x00});		//打印第2行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x1E,0x00,0x1F,0x00});		//打印第3行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x20,0x00,0x21,0x00});		//打印第4行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x22,0x00,0x23,0x00});		//打印第5行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x24,0x00,0x25,0x00});		//打印第6行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x26,0x00,0x27,0x00});		//打印第7行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x28,0x00,0x29,0x00});		//打印第8行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x2A,0x00,0x2B,0x00});		//打印第9行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x2C,0x00,0x2D,0x00});		//打印第10行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x2E,0x00,0x2F,0x00});		//打印第11行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x30,0x00,0x31,0x00});		//打印第12行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x32,0x00,0x33,0x00});		//打印第13行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x34,0x00,0x35,0x00});		//打印第14行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x36,0x00,0x37,0x00});		//打印第15行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x38,0x00,0x39,0x00});		//打印第16行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x3A,0x00,0x3B,0x00});		//打印第17行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x3C,0x00,0x3D,0x00});		//打印第18行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x3E,0x00,0x3F,0x00});		//打印第19行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x40,0x00,0x41,0x00});		//打印第20行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x42,0x00,0x43,0x00});		//打印第21行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x44,0x00,0x45,0x00});		//打印第22行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x46,0x00,0x47,0x00});		//打印第23行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x48,0x00,0x49,0x00});		//打印第24行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x4A,0x00,0x4B,0x00});		//打印第25行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x4C,0x00,0x4D,0x00});		//打印第26行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x22,0x00,0x00,0x00,0x41,0x00});						//27行线段上打印第1个字符
//			BtSPP.SPPWrite(new byte[]{0x1D,0x22,0x01,0x4C,0x00,0x42,0x00});						//27行线段上打印第2个字符
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x4E,0x00,0x4F,0x00});		//打印第27行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x50,0x00,0x51,0x00});		//打印第28行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x52,0x00,0x53,0x00});		//打印第29行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x54,0x00,0x55,0x00});		//打印第30行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x56,0x00,0x57,0x00});		//打印第31行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x58,0x00,0x59,0x00});		//打印第32行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x5A,0x00,0x5B,0x00});		//打印第33行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x5C,0x00,0x5D,0x00});		//打印第34行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x5E,0x00,0x5F,0x00});		//打印第35行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x60,0x00,0x61,0x00});		//打印第36行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x62,0x00,0x63,0x00});		//打印第37行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x64,0x00,0x65,0x00});		//打印第38行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x66,0x00,0x67,0x00});		//打印第39行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x68,0x00,0x69,0x00});		//打印第40行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x6A,0x00,0x6B,0x00});		//打印第41行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x6C,0x00,0x6D,0x00});		//打印第42行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x6E,0x00,0x6F,0x00});		//打印第43行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x70,0x00,0x71,0x00});		//打印第44行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x72,0x00,0x73,0x00});		//打印第45行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x74,0x00,0x75,0x00});		//打印第46行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x76,0x00,0x77,0x00});		//打印第47行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x78,0x00,0x79,0x00});		//打印第48行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x7A,0x00,0x7B,0x00});		//打印第49行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x7C,0x00,0x7D,0x00});		//打印第50行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x02,0x1A,0x00,0x1A,0x00,0x7E,0x00,0x7F,0x00});		//打印第51行2节线段
//			BtSPP.SPPWrite(new byte[]{0x1D,0x27,0x01,0x1A,0x00,0x3F,0x02});												//打印第52行线段
//			BtSPP.SPPWrite("\n \n".getBytes("GBK"));
//			*/
//			//try {Thread.sleep(1000);} catch (InterruptedException e) {}
//			BtSPP.SPPWrite(new byte[]{0x1B,0x40});		//打印机复位
//			BtSPP.SPPWrite(new byte[]{0x1B,0x61,0x01});	//居中
//			BtSPP.SPPWrite("===================================== \n".getBytes("GBK"));
//			BtSPP.SPPWrite("\n \n".getBytes("GBK"));
//			BtSPP.SPPWrite("******** 测试结束 ******** \n".getBytes("GBK"));
//			BtSPP.SPPWrite("\n \n".getBytes("GBK"));
//
//		} catch (UnsupportedEncodingException e) {
//		}
//		try {Thread.sleep(1000);} catch (InterruptedException e) {}
//		BtSPP.SPPClose();
//	}
//	public void Print4(String BDAddress)
//	{
//		if(!BtSPP.OpenPrinter(BDAddress))
//		{
//			Toast.makeText(this,BtSPP.ErrorMessage, Toast.LENGTH_LONG).show();
//			return;
//		}
//		BtSPP.SPPWrite(new byte[]{0x0C});		//走到左黑标
//		BtSPP.SPPClose();
//	}
//	public void Print5(String BDAddress)
//	{
//		if(!BtSPP.OpenPrinter(BDAddress))
//		{
//			Toast.makeText(this,BtSPP.ErrorMessage, Toast.LENGTH_LONG).show();
//			return;
//		}
//		BtSPP.SPPWrite(new byte[]{0x0E});		//走到右黑标
//		try {Thread.sleep(1000);} catch (InterruptedException e) {}
//		BtSPP.SPPClose();
//	}
//	public void Print6(String BDAddress)
//	{
//		if(!BtSPP.OpenPrinter(BDAddress))
//		{
//			Toast.makeText(this,BtSPP.ErrorMessage, Toast.LENGTH_LONG).show();
//			return;
//		}
//		BtSPP.SPPWrite(new byte[]{0x1D,(byte) 0x0C});		//走到标签处
//		try {Thread.sleep(1000);} catch (InterruptedException e) {}
//		BtSPP.SPPClose();
//	}
//}
